package cn.lblbc.webbrowser.utils

import android.content.Context
import android.content.SharedPreferences

class IncognitoManager(context: Context) {
    private val prefs: SharedPreferences = context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
    
    companion object {
        private const val PREFS_NAME = "incognito_prefs"
        private const val KEY_INCOGNITO_MODE = "incognito_mode"
    }
    
    fun isIncognitoMode(): Boolean {
        return prefs.getBoolean(KEY_INCOGNITO_MODE, false)
    }
    
    fun setIncognitoMode(enabled: Boolean) {
        prefs.edit().putBoolean(KEY_INCOGNITO_MODE, enabled).apply()
    }
    
    fun toggleIncognitoMode(): Boolean {
        val newMode = !isIncognitoMode()
        setIncognitoMode(newMode)
        return newMode
    }
}